// Copyright 2006 PR1ME. All Rights Reserved.
public class Match implements Comparable {

  public Match(CorpusFile file, int rating) {
    this.file = file;
    this.rating = rating;
  }

  public int compareTo(Object o) {
    Match other = (Match) o;
    if (this.rating == other.rating) {
      // doesn't matter: just give it a consistent sort order
      return other.file.getFilePath().compareTo(this.file.getFilePath());
    }
    return other.rating - this.rating;
  }

  public CorpusFile getFile() {
    return file;
  }

  public int getRating() {
    return rating;
  }

  public String toString() {
    return "<" + file + ", " + rating + ">";
  }

  private final CorpusFile file;
  private final int rating;

}
